import { BaseWindow } from "../../../component/window/BaseWindow";
import { GTextFormat } from "../../../common/GTextFormat";
import { Language } from "../../../../extend/language/Language";
import { ObjCreate } from "../common/ObjCreate";
import { LoaderManager } from "../../../../com/gengine/resource/LoaderManager";
import { CopyAccountLabel } from "../copy/popupBox/CopyAccountLabel";
import { SCopyMsgInfo } from "../../../../Message/Public/SCopyMsgInfo";
import { GButton } from "../../../../com/mui/controls/GButton";
type int = number;
//class CoinCopyRewardsAccountPanel
    
    export  class CoinCopyRewardsAccountPanel extends BaseWindow
    {
        constructor()
        {
            super();
            this.setSize(313, 350);
            this.titleHeight = 43;
            titleHeight = 26;
            this._tf = new GTextFormat();
            this._tf.font = "黑体";
            this._tf.color = 16772117;
            this._tf.size = 30;
            title = Language.getString(42016);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._bg = new Object /* flash.display.Bitmap */();
            this._bg.x = 18;
            this._bg.y = 40;
            this.addChild(this._bg);
            ObjCreate.createBg(18, 40, 277, 260, this);
            LoaderManager.instance.load("copy_accounts_bg.png", this.onLoadComplete);
            this._killedMonstersLabel = this.createAccountLabel(35, 50);
            this._killedBossLabel = this.createAccountLabel(35, 85);
            this._maxCutsLabel = this.createAccountLabel(35, 120);
            this._coinLabel = this.createAccountLabel(35, 155);
            this._coinBindLabel = this.createAccountLabel(35, 190);
            this._bmpCongratulations = new Object /* flash.display.Bitmap */();
            this._bmpCongratulations.x = 30;
            this._bmpCongratulations.y = 205;
            this.addChild(this._bmpCongratulations);
            this._bmpTips = new Object /* flash.display.Bitmap */();
            this._bmpTips.x = 95;
            this._bmpTips.y = 250;
            this.addChild(this._bmpTips);
            this._coinLabel.showUnit = CopyAccountLabel.Coin;
            this._coinBindLabel.showUnit = CopyAccountLabel.Coin_Bind;
            this._btnOK = ObjCreate.createGButton(Language.getString(42017), 120, 310, 70, 26, this);
            this._btnOK.addEventListener(flash.events.MouseEvent.CLICK, this.onButtonClick);
            return;
        }

        /* internal  */createAccountLabel(arg1: number, arg2: number): CopyAccountLabel
        {
            var loc1=null;
            loc1 = new CopyAccountLabel();
            loc1.x = arg1;
            loc1.y = arg2;
            loc1.addEventListener(CopyAccountLabel.CopyAccount_CountComplete, this.onCountComplete);
            this.addChild(loc1);
            return loc1;
        }

        public startAccounts(arg1: SCopyMsgInfo): void
        {
            this._killMonsters = arg1.num4;
            this._killBoss = arg1.num5;
            this._maxCuts = arg1.num3;
            this._coin = arg1.num6;
            this._coinBind = arg1.num7;
            this._isBreakCoin = this._coin + this._coinBind > arg1.num9;
            this._isBreakMonster = this._maxCuts > arg1.num8;
            this.reset();
            this._killedMonstersLabel.startCount("copy_accounts_killMonsters.png", this._killMonsters);
            return;
        }

        /* internal  */reset(): void
        {
            this._killedMonstersLabel.reset();
            this._killedBossLabel.reset();
            this._maxCutsLabel.reset();
            this._coinLabel.reset();
            this._coinBindLabel.reset();
            this._bmpCongratulations.bitmapData = null;
            this._bmpTips.bitmapData = null;
            return;
        }

        /* internal  */onCountComplete(arg1: Object /* flash.events.Event */): void
        {
            var loc1=arg1.target;
            switch (loc1) 
            {
                case this._killedMonstersLabel:
                {
                    this._killedBossLabel.startCount("copy_accounts_killBoss.png", this._killBoss);
                    break;
                }
                case this._killedBossLabel:
                {
                    this._maxCutsLabel.startCount("copy_accounts_maxCuts.png", this._maxCuts);
                    break;
                }
                case this._maxCutsLabel:
                {
                    this._coinLabel.startCount("copy_accounts_rewards.png", this._coin);
                    break;
                }
                case this._coinLabel:
                {
                    this._coinBindLabel.startCount("", this._coinBind, false);
                    break;
                }
                case this._coinBindLabel:
                {
                    this.setNewRecordText();
                    break;
                }
            }
            return;
        }

        /* internal  */setNewRecordText(): void
        {
            if (this._isBreakCoin) 
            {
                LoaderManager.instance.load("copy_accoutns_congratulations.png", this.onLoadComplete);
                LoaderManager.instance.load("copy_accoutns_moneyRecord.png", this.onLoadComplete);
            }
            else if (this._isBreakMonster) 
            {
                LoaderManager.instance.load("copy_accoutns_congratulations.png", this.onLoadComplete);
                LoaderManager.instance.load("copy_accoutns_continueKill.png", this.onLoadComplete);
            }
            else 
            {
                this._bmpCongratulations.bitmapData = null;
                this._bmpTips.bitmapData = null;
            }
            return;
        }

        /* internal  */onLoadComplete(arg1): void
        {
            var loc1=arg1.name;
            switch (loc1) 
            {
                case "copy_accounts_bg.png":
                {
                    this._bg.bitmapData = arg1.bitmapData as Object /* flash.display.BitmapData */;
                    break;
                }
                case "copy_accoutns_congratulations.png":
                {
                    this._bmpCongratulations.bitmapData = arg1.bitmapData as Object /* flash.display.BitmapData */;
                    break;
                }
                case "copy_accoutns_continueKill.png": case "copy_accoutns_moneyRecord.png":
                {
                    this._bmpTips.bitmapData = arg1.bitmapData as Object /* flash.display.BitmapData */;
                    break;
                }
            }
            return;
        }

        /* internal  */onButtonClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        public /* override */ dispose(arg1: Boolean=true): void
        {
            return;
        }

        /* internal */ /* var */_tf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_killMonsters: int;

        /* internal */ /* var */_killBoss: int;

        /* internal */ /* var */_maxCuts: int;

        /* internal */ /* var */_coin: int;

        /* internal */ /* var */_coinBind: int;

        /* internal */ /* var */_isBreakCoin: Boolean=false;

        /* internal */ /* var */_isBreakMonster: Boolean=false;

        /* internal */ /* var */_bg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_killedMonstersLabel: CopyAccountLabel;

        /* internal */ /* var */_killedBossLabel: CopyAccountLabel;

        /* internal */ /* var */_maxCutsLabel: CopyAccountLabel;

        /* internal */ /* var */_coinLabel: CopyAccountLabel;

        /* internal */ /* var */_coinBindLabel: CopyAccountLabel;

        /* internal */ /* var */_bmpCongratulations: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_bmpTips: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_newRecord: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnOK: GButton;
    }
